Optimal. Leaf size=97 \[ -b \left (3 a^2-b^2\right ) x-\frac {a \left (a^2-3 b^2\right ) \log (\cos (c+d x))}{d}+\frac {b \left (a^2-b^2\right ) \tan (c+d x)}{d}+\frac {a (a+b \tan (c+d x))^2}{2 d}+\frac {(a+b \tan (c+d x))^3}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3609, 3606,
3556} \begin {gather*} \frac {b \left (a^2-b^2\right ) \tan (c+d x)}{d}-\frac {a \left (a^2-3 b^2\right ) \log (\cos (c+d x))}{d}-b x \left (3 a^2-b^2\right )+\frac {(a+b \tan (c+d x))^3}{3 d}+\frac {a (a+b \tan (c+d x))^2}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rubi steps
\begin {align*} \int \tan (c+d x) (a+b \tan (c+d x))^3 \, dx &=\frac {(a+b \tan (c+d x))^3}{3 d}+\int (-b+a \tan (c+d x)) (a+b \tan (c+d x))^2 \, dx\\ &=\frac {a (a+b \tan (c+d x))^2}{2 d}+\frac {(a+b \tan (c+d x))^3}{3 d}+\int (a+b \tan (c+d x)) \left (-2 a b+\left (a^2-b^2\right ) \tan (c+d x)\right ) \, dx\\ &=-b \left (3 a^2-b^2\right ) x+\frac {b \left (a^2-b^2\right ) \tan (c+d x)}{d}+\frac {a (a+b \tan (c+d x))^2}{2 d}+\frac {(a+b \tan (c+d x))^3}{3 d}+\left (a \left (a^2-3 b^2\right )\right ) \int \tan (c+d x) \, dx\\ &=-b \left (3 a^2-b^2\right ) x-\frac {a \left (a^2-3 b^2\right ) \log (\cos (c+d x))}{d}+\frac {b \left (a^2-b^2\right ) \tan (c+d x)}{d}+\frac {a (a+b \tan (c+d x))^2}{2 d}+\frac {(a+b \tan (c+d x))^3}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.58, size = 100, normalized size = 1.03 \begin {gather*} \frac {3 \left ((a+i b)^3 \log (i-\tan (c+d x))+(a-i b)^3 \log (i+\tan (c+d x))\right )-6 b \left (-3 a^2+b^2\right ) \tan (c+d x)+9 a b^2 \tan ^2(c+d x)+2 b^3 \tan ^3(c+d x)}{6 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 97, normalized size = 1.00
method | result | size |
norman | \(\left (-3 a^{2} b +b^{3}\right ) x +\frac {b \left (3 a^{2}-b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {3 b^{2} a \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {a \left (a^{2}-3 b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(95\) |
derivativedivides | \(\frac {\frac {b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {3 b^{2} a \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 a^{2} b \tan \left (d x +c \right )-b^{3} \tan \left (d x +c \right )+\frac {\left (a^{3}-3 b^{2} a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-3 a^{2} b +b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(97\) |
default | \(\frac {\frac {b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {3 b^{2} a \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 a^{2} b \tan \left (d x +c \right )-b^{3} \tan \left (d x +c \right )+\frac {\left (a^{3}-3 b^{2} a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-3 a^{2} b +b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(97\) |
risch | \(-3 a^{2} b x +b^{3} x +i a^{3} x -3 i a \,b^{2} x +\frac {2 i a^{3} c}{d}-\frac {6 i a \,b^{2} c}{d}-\frac {2 i b \left (9 i a b \,{\mathrm e}^{4 i \left (d x +c \right )}-9 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}+6 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+9 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}-18 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+6 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-9 a^{2}+4 b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}+\frac {3 a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) b^{2}}{d}\) | \(206\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 95, normalized size = 0.98 \begin {gather*} \frac {2 \, b^{3} \tan \left (d x + c\right )^{3} + 9 \, a b^{2} \tan \left (d x + c\right )^{2} - 6 \, {\left (3 \, a^{2} b - b^{3}\right )} {\left (d x + c\right )} + 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (3 \, a^{2} b - b^{3}\right )} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.41, size = 94, normalized size = 0.97 \begin {gather*} \frac {2 \, b^{3} \tan \left (d x + c\right )^{3} + 9 \, a b^{2} \tan \left (d x + c\right )^{2} - 6 \, {\left (3 \, a^{2} b - b^{3}\right )} d x - 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (3 \, a^{2} b - b^{3}\right )} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.11, size = 128, normalized size = 1.32 \begin {gather*} \begin {cases} \frac {a^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 a^{2} b x + \frac {3 a^{2} b \tan {\left (c + d x \right )}}{d} - \frac {3 a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {3 a b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} + b^{3} x + \frac {b^{3} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {b^{3} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{3} \tan {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 993 vs.
\(2 (93) = 186\).
time = 1.32, size = 993, normalized size = 10.24 \begin {gather*} -\frac {18 \, a^{2} b d x \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 6 \, b^{3} d x \tan \left (d x\right )^{3} \tan \left (c\right )^{3} + 3 \, a^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 9 \, a b^{2} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 54 \, a^{2} b d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 18 \, b^{3} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 9 \, a b^{2} \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 9 \, a^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 27 \, a b^{2} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 18 \, a^{2} b \tan \left (d x\right )^{3} \tan \left (c\right )^{2} - 6 \, b^{3} \tan \left (d x\right )^{3} \tan \left (c\right )^{2} + 18 \, a^{2} b \tan \left (d x\right )^{2} \tan \left (c\right )^{3} - 6 \, b^{3} \tan \left (d x\right )^{2} \tan \left (c\right )^{3} + 54 \, a^{2} b d x \tan \left (d x\right ) \tan \left (c\right ) - 18 \, b^{3} d x \tan \left (d x\right ) \tan \left (c\right ) - 9 \, a b^{2} \tan \left (d x\right )^{3} \tan \left (c\right ) + 9 \, a b^{2} \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 9 \, a b^{2} \tan \left (d x\right ) \tan \left (c\right )^{3} + 2 \, b^{3} \tan \left (d x\right )^{3} + 9 \, a^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 27 \, a b^{2} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 36 \, a^{2} b \tan \left (d x\right )^{2} \tan \left (c\right ) + 18 \, b^{3} \tan \left (d x\right )^{2} \tan \left (c\right ) - 36 \, a^{2} b \tan \left (d x\right ) \tan \left (c\right )^{2} + 18 \, b^{3} \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, b^{3} \tan \left (c\right )^{3} - 18 \, a^{2} b d x + 6 \, b^{3} d x + 9 \, a b^{2} \tan \left (d x\right )^{2} - 9 \, a b^{2} \tan \left (d x\right ) \tan \left (c\right ) + 9 \, a b^{2} \tan \left (c\right )^{2} - 3 \, a^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 9 \, a b^{2} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 18 \, a^{2} b \tan \left (d x\right ) - 6 \, b^{3} \tan \left (d x\right ) + 18 \, a^{2} b \tan \left (c\right ) - 6 \, b^{3} \tan \left (c\right ) + 9 \, a b^{2}}{6 \, {\left (d \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 3 \, d \tan \left (d x\right ) \tan \left (c\right ) - d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.83, size = 135, normalized size = 1.39 \begin {gather*} \frac {\mathrm {tan}\left (c+d\,x\right )\,\left (3\,a^2\,b-b^3\right )}{d}+\frac {b^3\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d}-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {3\,a\,b^2}{2}-\frac {a^3}{2}\right )}{d}+\frac {3\,a\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d}-\frac {b\,\mathrm {atan}\left (\frac {b\,\mathrm {tan}\left (c+d\,x\right )\,\left (3\,a^2-b^2\right )}{3\,a^2\,b-b^3}\right )\,\left (3\,a^2-b^2\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________